package com.xn2001.mybatisplus.controller;

import com.xn2001.mybatisplus.entity.Student;
import com.xn2001.mybatisplus.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by 乐心湖 on 2020/3/7 21:27
 */
@RestController
public class StudentController {
    @Autowired
    private StudentMapper studentMapper;

    @GetMapping("/")
    public List<Student> findAll(){
        return studentMapper.selectList(null);
    }

    @DeleteMapping("/{id}")
    public void delete(@PathVariable int id){
        studentMapper.deleteById(id);
    }
}
